<?php
namespace app\admin\controller;
use think\Controller;

class Index extends Controller 
{
    public function index()
    {
    	return $this->fetch();
    }

        public function welcome()
    {
    	$info = array(
    		'host_name' => gethostbyaddr(input('server.REMOTE_ADDR')), //获取计算机名
    		'addr' => input('server.SERVER_ADDR'),	//获取服务器IP
    		'name' => input('server.SERVER_NAME'),	//获取服务器域名
    		'system' => PHP_OS,	//获取服务器操作系统
    		'port' => input('server.SERVER_PORT'), //获取服务器端口
    		'apache' => apache_get_version(), //获取apache和php版本
    		'pwd' => getcwd(), //获取当前文件目录
    		'cpu_num' => system('cat /proc/cpuinfo | grep "cpu cores" | wc -l'), //获取CPU数量(windows无法获取)
    		'usage' => sprintf("%.2f",substr(sprintf("%.3f", memory_get_usage()/1024/1024), 0, -2)),	//内存使用量
    		);

    	$this->assign('info', $info);
    	return $this->fetch();
    }
}
